Parsing errors now handled via exceptions, added function looping