some cleaning

Hi

here some cleaning of the code and adding couchdb view code.