Remove redundant newline, reduce duplication of code - resolve issues 56, 57