UI scaling improvements and code cleanup