Fix bug where wrong extras where used
Add state saving
Remove trailing whitespaces