Add ability to specify function as 'observe'
added changes for observe function handling