Added write command. Almost fully functional.