cleanup ruby code