tweaked parameters and fixed some bugs