Improve gateway & log process