lots of bugs fixed, more testing