cleaning up some redundancy and deleting unused function.