Refacting lib