Refactor to be a little bit neater.