fix worker.c coding style and few extra leaks, adding comments about whether a function returns a new ref or a borrowed ref
finish coding style fix and all memory leaks that I can find