will now only run object detection once rather than looping it, could be done prettier.