Final

Added few more error checking