[fix #3] code refactor