Add ruby code 'clean up dup code'