Remove unnecessary code and Rubyify