Refactored to work in localhost