iPad working but the code is SO UGLY!