Added missing endifs.
Another small bug fix. Changed an '=' to '+='.