added supporting of changing status of fingers and refactored some code