code cleanup thanks to source analysis