function cleanup, more comments