Make it more clever, but now not all tests passed :(