Completed task

I completed the first task by reogranizing everything into functions