small code refactors