code cleanup (PSR), some variable visibility changes