just moving some things around, adding logging