updating code style and layout for readability.