Scrutinizer and cleanups

tidying up
private API used - looks like we need a public API for this?

@icewind1991