button driver code cleaning