Clean up code and major edits