improve build system & add tests