small code re-structuring