Fixed parse_filename() and added support and testing for corner cases.