Refactores the code entirely.