remove loop, write as function
cleanup