Refactor to allow for handling special gems cleanly