Wrote a test to check that dom nodes were being created. Fixed code to use deferred promises were needed.