Internally use doubly-linked list instead of singly-linked list. Also minor fixes related to changing use to doubly-linked list. Removed unnecessary comments. Move list add/remove code to designated functions.
Kept in git history just in case.