Seems like the code is almost finished.
All that remains is to add some more comments
Version 1.0 that is a lot cleaner than the old one.
Tab closing functions correctly, saving offers only some extenstion, and
the code is a lot cleaner.