trying to implement as DOM