Cleaned up code and added comments on broken codes