Added Write functionality

Intensive testing needs to be done
fmmap.c can be divided into more managable and sensible methods