added pipe functionality for redirecting stdout and err. will be used on setting console header.
added full support for buffer clear and multiple token occurance in string