Add testing and error capturing. The function should be able to be called by passing in a generic filename.