Created method for listening events