Refactor code to match the interface