added mouse clicking to cast spells, reindent