Improve state definition API