Refactors Pin class to work with node eventemitter.