added a b flag to the open file statement, this should get appends to occur on newlines