a more functional style