created common functions for generating UI