re-factor and re-arrange