Reduce lines and fix some error