Add some globals
Add log and requirments
Rewrite save method to promises
rewrite write method to promises
Update debug information