Moved states to new file and added pet state checking