[refac][fix] refactorizes the layer interface and updates the layers implementation

In addition it also fixes many compilation warnings and makes
the unit tests compilable and runnable