Cleaned up classes, and fixed
Added comments for detail.