Additions, improvements, bugfixes...

Too much to name really, tested it on several files, it seems to be
working