using mixing to reduce duplicate code