fixed last command, better sanitization, display lines correctly