Added addState().
methods is now allowed to be an object or an array