Refactoring utilities object and fixing bugs.