Refactor almost done! Functioning!