refactor top-level; add loader
add check