fixed newline order
updated test coverage
removed redundant code and improved newline
updated test coverage