Attempt to make spare detection in app.js cleaner