Small refactoring to be more strongly typed