started refactoring listeners due to repeated code