Refactors code and documents it.