Refactor for sanity