Fixed error at edge cases. Pretty pretty printing