Refactored a lot of code, I really hope this doesn't break everything. I used master by accident. Sorry.