completed singleton code