Added modifications by Vanderlei