Bug fixing and tweaking