Added error checking functions taken from The Linux PI book. Modularized the app directory.