Add tests and enhance overall behavior