Add tests and remove singleton pattern