added some rudimentary checking functionality