allow user to specify storage type
improve error handling