Add better comments and messages
Refactor for easier reading