code clean up by follow DRY