Make lines use deques, which makes it a bit cleaner.

Unfortunately, we have to turn it back into a list. Deques don't support
slicing. -.-