improve modularization of some common controls