Cleaned up this messy code