Move computation out of Main