Optimize functions

PS2: Fix headers

Signed-off-by: htchoi1995 <htchoi1995@gmail.com>