lots of additions/fixes