Refactored some stupid stuff