Moved tests up, rewrote initial generation