added rev operation for vector and fixed bugs in collision()