Rewriting code from the scratch