Optimalization of 'checkPre' function