Refactor to objects with prototypes, use event emitter => needs cleaning