move data outside of handle function