Refactoring, added html escape characters for spaces