Fixed typos.
Added comments and removed unused conditions (for now).