Solved some bug and tests written