refactor code out of MainActivity into manager classes