commenting and readability improvements