Refines ids