Refactors old code