Removed console logs, and beautified the code