Database versioning,Proper Logging, Code cleanup

Added database versioning.Latest version will always be availabe in
info.plist file.

Addind a logging function named 'debugLog' which can switched ON/OFF
with a constants

Some code cleanup.