Readded code changed by Oscar.