Error handling
Apply only once.
removed apply state again, not needed.
Removed somme log outputs