Cleaned up and reorganized