refactor, simplified the solver. Added generation of solution with hashmap