Adding new features to the build system and fixing bugs, refs #689