Final commit: both functions tested with test script