Refines set and clear functions.