Add line wrapping for cursor navigation

Also a lot of comments. Is a good commit.