implement Emotion class
bug fix and refactoring