Use inheritance to reduce some duplicate code.