Properly handle functions