Fixed a glitch with api/libs

Also, libraries now use trait. Seperated the constructor and the setVars
function in b_library, b_controller and b_model. API should now work.