some boilerplate and cleanup