re-organization of the ruby code