moved things to functions