pure functional style and remove underscore dependency