Disk allocation algorithm - refactoring