added collision handling