major restructure and added formatter