Rewrote logic...now makes a bit more sense