Fixed crashing on Windows
Format code and small improvements
Merge branch 'dibel-develop'