Updated code for the 2D view for the application. Note that there might still be minor bugs in the code as the original code got lost so I had to rewrite it.