Making slug logic more robust