Updated singleton code