added some jQuery and states