the stateById structure is removed and its functinality is implemented by using graph db
applying improvements suggested in Alex's feed back