few bugfixes, reformatting.