added file saves back in and defined block as function