added collizion detection