Finished code

Haven't added comments yet