Restructured code
Added printf %s support