Fixed code based on feedback