added storage factory
simplify conditional syntax
forgot to return result