refactoring scope and erasing unused files