some small improvements and some cleanup