works, but do not understand the none type return