fixed lots of bugs, almost stable