some refactor for ips