Create Final Code

Needs testing and refinement therefater.