anishek | #2268 | using the correct order of executing statements and also using the global couchdb namespace