HD18M: Started clean-up the code and make it compile.