refactored language functions
massive refactoring