first version with function completed
first version passed the test