rework to clean up a bit