Added .editorconfig and some code changes
Script rewrite