divide sgf.hs into three files