added WIF storage logic, fixed line appending too many times, fixes #2