Refactored some code

refactored some code, sleazed up the way slot clicking was handled in
the casting table