Code clean up. Implemented solve()

There are typos in the previous commit