changing the category to UIViewController and adding a flag to keep track of the keyboards status so that notifications will not interfere with each other as view controllers transition between each other.