Improved action validation and added comments