Reorganize code, create standard types