Final clean up and added in-code documentation