fixes for my typo, code removal errors, and duplicate code (thanks BevapDin & kevingranade!)