improve BF algorithm implement and code style