Fixed warning because of wrong format
Some refactorings