The code is pretty messy right now. It needs to be rewritten in some parts, needs better comments (JSDoc) and better tests coverage.