Fixed issues with newlines and empty lines