Removed unnecessary loops and added ra_cross function