reworked structure
fix line removal
cleanup (working version)