Refactored code

Encapsulated all variables and loosetime functions inside loosetime
class