Simplify conditional logic around func, normalize code style