More inital coding; code rearranging