modularized more code