cleaning up and some small improvements