added type signatures to several functions