Some base changes

Added types files
Added errors file
Added comments
Renames keys.js to key.js