all sorts of wonderful stuff and bug fixes

note database structure change has been made