Cleaned up based on jslint