rest tests are donw (methinks)
moved locks
removed unused imports and added a flush