adding legend div
merge
Added new parameters for changing feedback status
Consolidate code