lib: allow custom states