Refactor to make it less hard-coded.