Fixed infinite loop
Started on Write Block function