added sprintf function, fixed output message