Code Cleanup! More robust!

 Major code clean up and security check. One security check a day keeps
segfault away!