Cleaned up formatting and added comments