Minor improvements. Some test cases currently failed due to the change in implementation, I will fix this soon.