lots of improvements and fixes!