Refactor https