refactor code

Signed-off-by: Jat <dpjat1@gmail.com>