Removing extra print lines and adding header