added min
factor out is_smaller in its own file
added max