Code cleanup and improvemnt for overriding standard widgets