updated flash message rendering
used correct assertion for counting
fixed tests adding some required params
fixed test
added a control to check if a key exits in array
refactored