moved events outside controller