able to get variables in the on method