Added logging mechanism.
Extracted extensions api to separate file.