theming and tightening up code