Gui check and Refactoring