More refactoring. Renamed some methods and Added utils.js with clamp function