restore continues

Restore lost code and simplify existing