boilerplate moved from Framewire source