Separation of sgen.h to sgen.cpp

First step in separation of header and source files.