Refactor gui package structure to avoid cyclic dependencies