whittled down some functions to more specific types to catch certain pattern matching errors at compile time