First batch of merging new SCLibrary interface. Removes usage of global library variable.
Lets merge first part that removes global variable usage by pulling context/library objects in every API that needs them. In second part new SCLibrary interface will be added.