added type validation to medium