put loose statements in function