Fixed the output function