Remove empty lines
Improve transaction handling