Corrected and improved getHRAO() function