added old code, must be cleaned