Iteration 2

Fixed rendering visuals, optimized the code