algorithm works
proper error handling
restructure and add test