Added TestMode + small changes