minor cleanup & refactoring

* validation of keylearning/inputvals as separate function
* minor code cleanup, pylint fixes