redid most of the code since it was becoming such a mess that I had no idea where the errors where.