adjust test to allow < 3 subgroups in a group
refactor decode logic for consistency and simplicity

- we don't need a simple factory if we always pass in the group type
  when invoking the decode function
- for each if condition, build the arguments and determine the decode
  function to use, and then invoke once at the end
add support for hash groups
bump version to 0.1.3
add license header