Added function checkword

Code committed was checked and is verified to work correctly.