Working version inc db access. Haml still to sort out."