removed some console statements and beautified