Finalize and clean up code for pull request