cleaning and consolidating and deleting now unused functions