initial optimization to pre-render layers, fixes #58