refactored to remove tc smells
fixed code style