Added the character remaining function, there maybe some problems, if so please let me know.