improved refactoring and handling of BED parsing.