Refactoring and added loop to work with emotes.js