added binaryheads and writeDEM
modified layer loop BOVheads
made totalLayers optional variable