Add additional camera register writing to try to prevent skew
Fix memory leak
Remove un-needed malloc
Return properly formatted json array for database requests
Factor common code out of database