moved data processing so it works