Function return types, minor fixes