added take and refactored min and max