Filled in functions as required, added test function