Added check for key availability