various small changes, code style, resource refactoring