Implement map action and improve error handling in console command