Refactoring is the process of restructuring, re-architecting and modifying existing code without affecting the output of the code. The aim is to reduce complexity simultaneously improving the ability to modify the code at a later date. I want to walk you through my own refactoring process with a real world example. We will be refactoring shtirlic/sinatra-jsonp. This is a small sinatra extension that adds support for older browsers when returning json as it provides callback function support.