Improved Error checking functionality. Also, fixed bug in wget command
Small Code cleanup