WIP: refactoring scan procedure to ease compression implementation