refactor variable declarations and token production