First draft of code