Fixed bugs, improved performance