add missing ; and small refactoring