Cleaned code and solved some compatibility issues
Some code cleaning