Refactoring update table script