Changed Error messages and fixed minor bugs.