Can you update the class like this: https://gist.github.com/rande/db10d0e2db9a2ab3409b

The code is more readable