Migrated old backend functionality from ruby to rails