Added missing licence section.
pcall() and error() should be handled in special way.
Added missing licence section.
Removed unused function, added comments.