completed full code tidy and fixed many small bugs - though may have introduced some due to scale of changes