code cleanup, ver. 3