Remove not needed code, improve tests