Slightly restructured code, added character drawing and directionality