Cleaned up and simplified things.
- Removed unnecessary casts and uses of `sender_id`
- Got rid of the "subscript out of range" warnings