code improvement for ui