source changes and update to madlib.cpp

getmadlib fuction adjusted to work with source