refactored with new codestyle