Updated design, several code corrections