Refactor prefix_size