Working code
Fix Write not flushing
Working!