a bit refactored singletone js