Add tests, improve code addition