Added safety code