more refactoring for BS3