Fixing the infinite loop I had...this is kinda ugly