Simple javascript object that can handle states