added type validation