Check instance.hasOwnProperty instead of data's
Spaces to tabs and minor refactoring
Fix tests, need sql-query updated to PR #37