refactoring and added index.html on first opening file