clarified variable names and changed false to nil