Feature/1216 tern support

Code for issue #1216