Finalised

Finalised functions and gui code