code tidy up - missing comment blocks & formatting