You shouldn't need the .nil? And not, just do if current_document. Ditto for below