small refacoring and clean up