How to extend bean functions in 7.2?

I'm using SugarCRM 7.2. I have written some functions directly on modules/Products/Product.php. But this is not an upgrade safe manner. So can anyone please help me on how can I move those functions to custom folder? Previously I've done it through controller.php but I'm not very much confident in Sugar 7.2 can anyone help me out please