First draft of rewrite
Complete the rewrite