Add tests for level completion and move some related code to specific methods