code functional with localhost