added simple javascript method invokation and cleanup.