Cleaned up codebase/added better comments