Fixed some logical errors, working on completing this thing by tomorrow