Removed superflous ifs, and redundancy.