Cleaned up comments and renamed functions