Added support to console and fix some pieces of code