Improved build scripts. Code restructuring.