Small improvements to solve. Added test cases