Added UI components and fixed some math