code before correcting for closure error