tweaked some things got rid of redundancies. also added comments.