refactor keyboard toolbar using templates