adjusted collision system and fixed an inefficient loop