Added type specifications to functions.