Improved baselib-parsing logic, moved out more functionality from stdlib into baselib