Cleaned up code

and made a few edits.