added reserve to random_acces_set
added functions to reserve space for functions and factors
minor refactoring
minor changes