Adjust picking mask and clean up code.