Minor code refactoring. Fixed duplicit character bug. HP bug.