Make module more idiomatic using map and grep for list operations.