minor improvements after code analysis