Restructuring rover code