updated with function editing