almost done modularizing