don't hardcode .txt path, refactor dupe code