added unit tests, updated build scripts