updated with brad changes and then tweaked to compile