Two small mistakes and removed some unnecessary code.