adding more flexebility to generateButten function