cleanup with help from @jairideout