refactor
cleanup, move dom code