A cleaner implementation of the __check__ functionality

This pull request obsoletes #87, it is hopefully a bit cleaner implementation.