Added internet permission, refactoring