add singleton code