Wrote test for all functions + code changes