Finishing touches on refactor