Refactor types