added logwriter functionality