Updated/Added error detection for all parsing functions