That looks more like it.
Is the L165 still a current device?
If not what is a suitable currently available option?
The circuits a bit more sophisticated than the one I spotted but looks much more like what I need and shouldn't take up too much space.
Andy