Corrected the order of output