First draft of code. It works!