refactored bedfile