Modal refactor for function declarations