Add modules to build script.
Implementation conforms to latest versions of compilation and staticanalysis; some bug fixes; code comments formatted for Haddock.