some code for detecting character

NOT TESTED SOMEONE TEST PLEEAAASSSEEE :)