BF - Rearranged some code to possilbe improve perfomance slightly