BUG: Fixed some bugs. Improved performances.