began clean up and refactor