cleaned up main activity code

things are nicer, still slow but I think I know why