remove newline and prompt characters - BW
implemented helper funtions - BW