Refactored the language processor to make prettier code