added logic to pass variables to view