even more code documentation and some cleanup