cleanup and polish, consolidating es calls, better error handling