added an option to return an object