Many improvements and new code