Stats controller refactoring

moved a bunch of db queries to subs. one complex one is still missing..
/me is currently too lazy to re-design the last one :P