implemented variable definitions and references