this is a quick hack which really needs to be cleaned up