Code for the paper sorter