factoring out inventory functions into module