added method to determine name for saving data, improved documentation and input checking