Add tests for function parsing

Refactor function literals