Fixed create context issues
Clean up the code