piece saving into heap implemented
file flushing implemented