Fixed checkcollision. Should do a cleanup of the code soon