added checkArgs function to simply code
changed result to local<Object> and changed malloc for C++ new
added comments describing functions