A lot of improvements and bug-fixes