Delete legacy code, change conditional to polymorphic, use better ruby commands