Now werer getting somewhere... Added DB Writing capabilities