added type declarations to functions