refactor Layout and Widget