writing better action dispatch, resolving errors