Added database functionality

BUGS: 1. couchdb library not supported in google app engine 2. Next
match throws JSON error after repeated requests