Added bool checking to engine loop.