made parsing script into a function

WITH VARIABLES HRUHEUHEUHEUHE
more function documentation

YEP