newCustomElementWithCallbacks() function added and used in tests; minor code format and naming changes