Added special case for slopes that are 'nan' -Brian