First implementation of function call resolution mechanism.

Need for code review...