Test file generated for preview, also bit of code cleanup