Refactor for work with virtual hosts