Reorganize code for gem packaging.