Further code cleanup and styling for readability.