Lots of fixed bugs and improved performance