Moved API class into separate file
API raises better errors
Added dynamic requiring of files/dependencies and finished key generation