Proved it is possible to render partials in a for loop

Added tests for rendering partials inside a for loop. Also cleaned up some code.