Moved language and paper type detection into utils class, added unit tests