Fix failing tests, and rename function