Fixed last merge's issues and removed old code