added performance tests and done optimizations in kernel