Code cleanup, fix comments