improved the implementation of beta