Remove last line delimiter
Added unit tests