Efficiency and  the like

Optimizing code and DB interactions a bit