Implement clean-up with tests correctly

it might be a bit overheady but the best we could achieve in an hour