update comments and refactor a few bits