Reworked target functions and added Smart Cast modifier. This fixes #56