Added new cases
Simplified code