improve and standardize code