Checking for edges when rendering (fixes #20)