#2 #3 updated some TODO notes
#2 typos corrected
#4 added categories and version to DB
#1 works with categories in DB
** tiding up the code