I was stopped for what seemed like a long time. What was the officer doing in his car all that time? 

The officer is doing more than filling out a form. License and registration checks are made via radio or mobile data computer. Like the Internet, these inquiries are subject to delay due to volume or other technical circumstance. Officers need to make these checks and try their best to conclude the traffic stop as expeditiously as possible.