Fixed code format, removed commented out code and obsolete methods