fixed and improved the performance a bit more