added build script, refactoring