Improve logging and options parsing