Remove duplicated code by moving methods to UITools