Some tests and improvment