initial converted code for HColorField