Changed library to a Javascript class definition to allow multiples instances