Migrate to QGIS 2.x API
Fix code style