Remove beforeRender hook
Refactoring
Add exception message
Attach data if array is not empty