Refactored utils and other stuffs.