Added support for adding a function as view object