changed the layout of stats/optimise

moved stats functions to optimise