Squashed multiple min function to just one min call