Modified app to better handle inputs.