Mark possible bug, some cleanup
Improve readability, no semantic changes