Little clean up and fix empty array bug