tidy up internals