remove duplicate code to the best of my ability right now