Refactoring/rewriting js to make sure only one cat is open at a time.