testing code with a few bugfixes