reintroduced allocation function