Use frontmost application instead of running application.
Merge pull request #1 from moaa/master

Use frontmost application instead of running application.
Code clean-up necessary...