transformed to eventemitter and added more flexible texting