Check variables: move code to class, fix tests
Wip