Added usage of `state` parameter, closes #4.