some code cleaning following ruby best practices