2nd draft of code