rework some of dat code