finishing touches on function