using split_contents(), removing import re, adding docstrings