Add an option to use collision box for out of bound detection
also some minor change