using split_contents(), removing import re, adding docstring