Improved build scripts, cleaned up codebase.