code cleanup, but it still does not work as expected.