using compact to get rid of nil