added partition function