Fixed compile errors and formatted output