Completed key loading and navigation code