working sample code generation