added class functions and perror