Base code for character generation