modified write to filesystem
outsourced code to getMassOfSession function