Improving tests
Add more tests and refactors