HFile: improved interface, cleaned up the code.