Updated to work in console