changed delete ifs to sekects made get_state_by_name a private method, some code style tweaks