Updated build script and added automatic test