Refactored some codes, changed class methods to instance methods
Minor Fixes