updated with function