fixed bug with invalid click events
code cleanup (javadoc, debug)