[SQUASH ME] address comments and fix some bugs