Implemented index calculation on database. Improved database
initialization and error handling.