updated code based on PSR