some style changes
README updated
added error checking