Add RefMan module and resolve various build script errors