added inverted field, small fixes
merged with new js
a lot of fixes from boris