CHARLOTTE, N.C. - Master P hasn't just cleaned up his act. He's gone back to school -- middle school.

The veteran gangsta rapper spent an hour Thursday talking to about 800 students at Monroe Middle School about the importance of education, good financial management and a vision for success.

Math teacher Bonnie Mwanda heard that the rapper, whose real name is Percy Miller, would be in Charlotte to promote a book and sent an e-mail asking him to stop by the school.

Miller grew up in public housing in New Orleans, but grew into a performer who sold millions of albums, started a record label and even played professional basketball, including two exhibition games for the now-departed Charlotte Hornets.

Mwanda hoped his success might be an inspiration for her students, many of whom come from similar backgrounds.

"I thought it was a long shot," she said. "Sometimes they (celebrities) say they want to help kids, but it's a publicity stunt."

Not only did Miller hand out advice, he also expressed regret for the tone of his earlier work. Master P is one of a number of rap artists who have pledged to clean up their rhymes, launching a label that will feature similarly clean performers.

Its first release is "Hip Hop History," which Miller made with his son Romeo, who stars on his own Nickelodeon series.

"Y'all know I started off on the wrong track," Miller said. "The most important thing I've done with my life is clean my act up. I'm sorry for making the music that I made without thinking about y'all."

He also put in a plug for teachers' efforts to improve test performance at the school.

"If the principal tells me y'all have a good year," he said to screams and cheers, "I'm going to bring Romeo back to do a concert."