Added hstore and some logic