Cleaned up main file, added comments