migrated controller code back into the gem