First draft

Initial draft of function