Added misery scoring

Added tests and correct implementation for misery scoring