Move "check for function attribute" functionality in its own function.
Remove redundant check for empty function.