Improved variable equals and state; added tests for both