Added type restriction
Added comments and parameter to ChangeState