did some refactoring in preparation for adding support for variables