Restructured a bit will probably need to refactor later.