code cleanup and add logging
add more logging
update CORS header
add console loggging