Fix UI Constraints Bug & Refine Code