Cleaned up A8 code a bit.
Make sure first_line is actually the first line, and same for last_line.