Cleaned up indentation and added comments