Code cleanup, generalization.