Tidied code - no functionality changes