code refactor complete