Finalizeation of code portion

Now to work on the flowchart and attempt to clean up the code if
required