Cleaned up and basic debugging