refactored to psr-2 coding standard