Added some utils functions + Refactored