Remove more commented-out code
Add some missing casts