bugfixes, code standardization, refactoring