Added error checker