Added snprintf for printing result