Code improvements

Config format changed: [main] is not necessary
Code reorganization
Change code style to PEP8