Modified behavior of lib

* codes are returned instead of returning stdout for lib calls
* lib calls stdout is printed directly