refactoring out demo and dom functions from wrapper