Refined a few lines of code