tidied birange function