Rearchitect a little bit to make sure this will work across dirs