some fixes and refactoring/renaming