Refactor rendering

Spawned new bugs that need to be fixed (extra line in root block,
function calls as statements do not have line breaks and text-only
rendering has too few line breaks).