cleaned up code, takes input from camera