added simple allocation function