Simplified code after review