Been rewriting code for the past 4 hours now. the couchdb jquery plugin is broken :(