refactor and webcam stuff