Refactors, still need to test