added collision code & boundary