Create Final Code

All code self-written except where commented.