added type specs to source and revised validate