Major bugfix
Made a replacement for the non-standard fpurge() function to flush the input of stdin