put together parts of vpdetection.py