Fixed counting to work.