modified: edit scratch func