Converting min function to handle full as well