Simplified code a bit more