changed file structure and corrcted bugs