refactor to oojs