changed code for pet.js