functions useful for AST4700 hw