cleaned up comments and renamed some variables