added type specs to all top level functions