Edited isExpired method