modified licensing
fixed indexing error, added NullPointerException