Fix failing tests
Clean code