code cleanup, layout fixes