Improve build configuration. Add tests.