Fixed performance issue as much as I can