Cleaned-up broken code