fixed some bugs...now still has out of range and other problems