Refactor boxCollides

Made collision logic more understandable