Version 4: errors fixed