breaking code up to handle async
breaking code up to handle async