Output is now printed properly, and in order