refactored code,added localhost environment