updated with new function