First draft of the code. No comments