Make use of automatic Button placement

The new method reduces line of codes and temporary variables.